package br.com.controller;

import java.sql.Connection;
import java.util.List;

import br.com.bean.DisciplinaTurmaBean;
import br.com.dao.DisciplinaTurmaDao;



public class DisciplinaTurmaController {

	public static void inserir(Connection conn, int turma, int disciplina, int CH) throws Exception{

		DisciplinaTurmaBean bim = new DisciplinaTurmaBean();
		bim.getIdturma().setId(turma);
		bim.getId_diciplina().setId(disciplina);
		bim.setCargahr(CH);

		DisciplinaTurmaDao dao = new DisciplinaTurmaDao();
		dao.inserir(conn,bim);
	}

	public static void excluir(Connection conn, int id) throws Exception{

		DisciplinaTurmaBean bim = new DisciplinaTurmaBean();
		bim.setId(id);

		DisciplinaTurmaDao dao = new DisciplinaTurmaDao();
		dao.excluir(conn,bim);
	}

	public static void update(Connection conn, int id, int turma, int disciplina, int CH) throws Exception{

		DisciplinaTurmaBean bim = new DisciplinaTurmaBean();
		bim.setId(id);
		bim.getIdturma().setId(turma);
		bim.getId_diciplina().setId(disciplina);
		bim.setCargahr(CH);


		DisciplinaTurmaDao dao = new DisciplinaTurmaDao();
		dao.alterar(conn,bim);
	}

	public static List<DisciplinaTurmaBean> ListDisciplina(Connection conn) throws Exception{

		DisciplinaTurmaDao dao = new DisciplinaTurmaDao();
		List<DisciplinaTurmaBean> disciplinaList = dao.getLista(conn);
		return disciplinaList;
	}
	
	//info das diciplinas cadastradas na turma
	
	public static List<DisciplinaTurmaBean> infoDiscTurma (Connection conn, int turma) throws Exception{
		DisciplinaTurmaDao dt = new DisciplinaTurmaDao();
		List<DisciplinaTurmaBean> info = dt.infoDidcTurma(conn, turma);
		return info;
	}
}